import 'package:flutter/material.dart';



class AnimatedButton extends StatefulWidget {
  const AnimatedButton({Key? key}) : super(key: key);

  @override
  _AnimatedButtonState createState() => _AnimatedButtonState();
}

class _AnimatedButtonState extends State<AnimatedButton> with TickerProviderStateMixin{

  bool isChanged = false;
  late AnimationController _controller;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    _controller = AnimationController(vsync: this,
    duration: Duration(seconds: 1));
  }



  @override
  Widget build(BuildContext context) {
    void trigger(){
      setState(() {
        isChanged = !isChanged;
        isChanged ? _controller.forward() : _controller.reverse();
      });
    }
    return IconButton(
            iconSize: 30,
            onPressed: trigger,
            icon: AnimatedIcon(
              icon:AnimatedIcons.ellipsis_search,
              color:Colors.blue,
              progress: _controller,
            )   ,
          );
  }
}
